I’ve attached the updated packing report dataview if you want to use it as a starting point for updating the OW dataview. Here is the relevant SQL for just the WITH and sub-select. The WITH CTE pulls all the tax and geo names for the regulations and the sub-select carefully compares them to the order geography and item taxonomy. I switch from using XML PATH to the STRING_AGG function, but had to use a sub-sub-select to get DISTINCT geo values for the list. (g3 is the final recipient geopgraphy.)

WITH treg AS (SELECT rtf.family_name, rtg.genus_name, rts.species_name, rts.subspecies_name, rts.variety_name, rts.subvariety_name, rts.forma_name
              , tr.regulation_type_code, g.country_code, g.adm1, cvl.title
       FROM taxonomy_regulation_map trm
       LEFT JOIN taxonomy_regulation tr ON tr.taxonomy_regulation_id = trm.taxonomy_regulation_id
       LEFT JOIN geography g ON g.geography_id = tr.geography_id
       LEFT JOIN code_value cv ON g.country_code = cv.value AND cv.group_name = 'GEOGRAPHY_COUNTRY_CODE'
       LEFT JOIN code_value_lang cvl ON cv.code_value_id = cvl.code_value_id and cvl.sys_lang_id = 1
       LEFT JOIN taxonomy_species ts ON ts.taxonomy_species_id = trm.taxonomy_species_id
       LEFT JOIN taxonomy_species rts ON rts.taxonomy_species_id = ts.current_taxonomy_species_id
       LEFT join taxonomy_genus tg ON tg.taxonomy_genus_id = trm.taxonomy_genus_id
       LEFT JOIN taxonomy_genus rtg ON rtg.taxonomy_genus_id = COALESCE(rts.taxonomy_genus_id, tg.current_taxonomy_genus_id)
       LEFT JOIN taxonomy_family rtf ON rtf.taxonomy_family_id = COALESCE(rtg.taxonomy_family_id, trm.taxonomy_family_id)
)

…

(SELECT STRING_AGG(regtext, '$ ') FROM
     (SELECT DISTINCT COALESCE(adm1, '') AS regtext
              FROM treg
              WHERE regulation_type_code IN ('SEED', 'TERRESTRIAL', 'AQUATIC', 'PARASITIC')
                AND treg.family_name = tf.family_name
                AND COALESCE(treg.genus_name, tg.genus_name) = tg.genus_name
                AND COALESCE(treg.species_name, ts.species_name) = ts.species_name
                AND COALESCE(treg.subspecies_name, ts.subspecies_name, '') = COALESCE(ts.subspecies_name, '')
                AND COALESCE(treg.variety_name, ts.variety_name, '')= COALESCE(ts.variety_name, '')
                AND COALESCE(treg.subvariety_name, ts.subvariety_name, '')= COALESCE(ts.subvariety_name, '')
                AND COALESCE(treg.forma_name, ts.forma_name, '')= COALESCE(ts.forma_name, '')
                AND treg.country_code = g3.country_code AND COALESCE(treg.adm1, g3.adm1, '') = COALESCE(g3.adm1,'')              
       ) disttreg
  ) AS noxious_restriction 


Kurt
